import java.io.*;
public class Main {
    public static void main(String[] args) {
        String filePath = "C:\\KS\\foodinfo.txt";
        try (BufferedReader reader = new BufferedReader(new FileReader(filePath))) {
            reader.readLine();
            System.out.println("食物，每100克铁元素含量（毫克）");
            String line;
            double max = 0.0;
            String maxFoodName = "";
            while ((line = reader.readLine())!= null) {
                String[] strs = line.split(",");
                int weight = Integer.parseInt(strs[2]);
                double feWeight = Double.parseDouble(strs[3]);
                double ans = feWeight / weight * 100;
                System.out.println(strs[0] + "," + ans);
                if (ans > max) {
                    max = ans;
                    maxFoodName = strs[0];
                }
            }
            System.out.println("含铁量最高的食物是: " + maxFoodName + ", 含铁量(毫克/100克): " + max);
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
